#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Project: spd-sxmcc
"""
@author: lyndon
@time Created on 2018/10/10 17:05
@desc
"""

import os

# 调试模式是否开启
DEBUG = True

SQLALCHEMY_TRACK_MODIFICATIONS = False

SQLALCHEMY_NATIVE_UNICODE = True

SECRET_KEY = 'ty@puton.info'

SQLALCHEMY_POOL_TIMEOUT = 60

try:
    PROFILE = os.environ["SPD_PROFILE"]
except Exception as e:
    PROFILE = 'dev'

if PROFILE == 'dev':
    dashboard_id_by_postdate = "AWDeBuN8c-kCJTfpPOIF"
    dashboard_id_by_crawtime = "AWDeIHx0c-kCJTfpPOIH"
    kibana_host = '20.26.26.43:5601'
    weixinmp_db = 'resultdb/resultdb_1Q#@20.26.26.250:1521/pdb_bdprd'
    hive_db = 'postgresql://pyspd_admin:pyspd_admin_1Q#@localhost:5432/spd_mgr'
    ip_pool_db = 'mysql+mysqldb://pyspd_admin:pyspd_admin_1Q@192.168.100.161:3306/spd_mgr?charset=utf8'
    result_db = 'sqlalchemy+postgresql+resultdb://result_test:result_test_1Q#@localhost:5432/result_test_db'
    yuqing_db = 'resultdb/resultdb_1Q#@20.26.26.250:1521/pdb_bdprd'
    log_dir_master = "D:/programming/python/product/spidermanager/spidermanager"
    log_dir_slave = "D:/programming/python/product/spidermanager/spidermanager"
    basedir = 'D:/programming/python/product/spidermanager/spidermanager'
    # log_dir_master = "D:/Git/pyspider/git/spidermanager/spidermanager"
    # log_dir_slave = "D:/Git/pyspider/git/spidermanager/spidermanager"
    # basedir = 'D:/Git/pyspider/git/spidermanager/spidermanager'
    spdmgrport = 5000
    managerhosts = ['master.hadoop']
    workerhosts = ['slave1.hadoop', 'slave2.hadoop']
    SQLALCHEMY_DATABASE_URI = "oracle://spdmgr:spdmgr_1Q#@oracle-datasource:1521/pdbspdmgr"
    SHOW_DATABASE_URI = "oracle://SCOTT:gb666666@localhost:1521/ORCL"
    # SQLALCHEMY_DATABASE_URI = "mysql+mysqlconnector://app:123456@localhost:3306/spdmgr"
    redis_nodes = [{'host': '192.168.136.130', 'port': 7000},
                   {'host': '192.168.136.130', 'port': 7001},
                   {'host': '192.168.136.130', 'port': 7002},
                   {'host': '192.168.136.131', 'port': 7000},
                   {'host': '192.168.136.131', 'port': 7001},
                   {'host': '192.168.136.131', 'port': 7002},
                   ]
    redis_expires = 30
    landing = []
    hbase_host = 'master.hadoop'
    hbase_port = 9090
    accessid = ''
    accesskey = ''
    es_host = ['192.168.100.181', '192.168.100.182', '192.168.100.183']
    hdfs_web = "http://master.hadoop:50070"
    hdfs_dir = "/user/spider/cplatform/"
    hdfs_user = "hadoop"

elif PROFILE == 'vm':
    dashboard_id_by_postdate = "AWDeBuN8c-kCJTfpPOIF"
    dashboard_id_by_crawtime = "AWDeIHx0c-kCJTfpPOIH"
    kibana_host = '20.26.26.43:5601'
    weixinmp_db = 'resultdb/resultdb_1Q#@20.26.26.250:1521/pdb_bdprd'
    hive_db = 'spdmgr/spdmgr_1Q#@oracle-datasource/pdb_spdmgr'
    yuqing_db = 'resultdb/resultdb_1Q#@20.26.26.250:1521/pdb_bdprd'
    log_dir_master = "/home/spd/spidermanager/log"
    log_dir_slave = "/home/spd/spidermanager/log"
    spdmgrport = 5888
    basedir = '/home/spd/spidermanager/server/spidermanager'
    managerhosts = ['master.hadoop']
    workerhosts = ['slave1.hadoop', 'slave2.hadoop']
    SQLALCHEMY_DATABASE_URI = "oracle://spdmgr:spdmgr_1Q#@oracle-datasource:1521/pdbspdmgr"
    redis_nodes = [{'host': '192.168.136.130', 'port': 7000},
                   {'host': '192.168.136.130', 'port': 7001},
                   {'host': '192.168.136.130', 'port': 7002},
                   {'host': '192.168.136.131', 'port': 7000},
                   {'host': '192.168.136.131', 'port': 7001},
                   {'host': '192.168.136.131', 'port': 7002},
                   ]
    redis_expires = 30
    landing = []
    hbase_host = 'master.hadoop'
    hbase_port = 9090
    accessid = ''
    accesskey = ''
    es_host = ['20.26.26.43', '20.26.25.224', '20.26.25.225']
    hdfs_web = "http://master.hadoop:50070"
    hdfs_dir = "/user/spider/cplatform/"
    hdfs_user = "hadoop"

elif PROFILE == 'test':
    dashboard_id_by_postdate = "AWDeBuN8c-kCJTfpPOIF"
    dashboard_id_by_crawtime = "AWDeIHx0c-kCJTfpPOIH"
    kibana_host = '192.168.100.181:5601'
    weixinmp_db = 'resultdb/resultdb_1Q#@20.26.26.250:1521/pdb_bdprd'
    # hive_db = 'pyspd_admin/pyspd_admin_1Q#@pdb_bdprd'
    hive_db = 'postgresql://pyspd_admin:pyspd_admin_1Q#@192.168.100.181:1921/spd_mgr'
    result_db = 'sqlalchemy+postgresql+resultdb://result_test:result_test_1Q#@192.168.100.181:1921/result_test_db'
    yuqing_db = 'resultdb/resultdb_1Q#@20.26.26.250:1521/pdb_bdprd'
    log_dir_master = "/home/spd/spidermanager/log"
    log_dir_slave = "/home/spd/spidermanager/log"
    spdmgrport = 5888
    basedir = '/home/spd/spidermanager/server/spidermanager'
    managerhosts = ['192.168.100.181']
    workerhosts = ['192.168.100.182', '192.168.100.183']
    SQLALCHEMY_DATABASE_URI = "oracle://pyspd_admin:pyspd_admin_1Q#@orcl"
    redis_nodes = [{'host': '192.168.100.181', 'port': 7000},
                   {'host': '192.168.100.182', 'port': 7001},
                   {'host': '192.168.100.183', 'port': 7002},
                   {'host': '192.168.100.181', 'port': 7003},
                   {'host': '192.168.100.182', 'port': 7004},
                   {'host': '192.168.100.183', 'port': 7005},
                   ]
    redis_expires = 86400
    # persist = ["hbase","hdfs","es"]
    landing = []
    hbase_host = '10.78.138.74'
    hbase_port = 9090
    accessid = '480092febea017febfe4'
    accesskey = '3fe3bccd97e3c8cb9c5b57cffc74090671722641'
    es_host = ['192.168.100.181', '192.168.100.182', '192.168.100.183']
    hdfs_web = "http://10.78.138.81:50070"
    hdfs_dir = "/user/spider/cplatform/"
    hdfs_user = "hadoop"

elif PROFILE == 'prod':
    dashboard_id_by_postdate = "AWDfWNZ2iMBxsvNLaj-k"
    dashboard_id_by_crawtime = "AWDfV_F_iMBxsvNLaj-j"
    kibana_host = '10.78.238.55:5999'
    weixinmp_db = 'spd_dm/spd_dm_1Q#@pdb_spider'
    hive_db = 'spd_admin/spd_admin_1Q#@pdb_spider'
    ip_pool_db = 'mysql+mysqldb://pyspd_admin:pyspd_admin_1Q@192.168.100.161:3306/spd_mgr?charset=utf8'
    yuqing_db = 'resultdb/resultdb_1Q#@20.26.26.250:1521/pdb_bdprd'
    log_dir_master = "/data/log"
    log_dir_slave = "/srv/BigData/data1/log/univider/pyspider_log"
    spdmgrport = 5000
    basedir = '/home/spd/spidermanager/server/spidermanager'
    managerhosts = ['10.78.238.55']
    workerhosts = ['10.78.190.228', '10.78.190.229', '10.78.190.230', '10.78.190.231', '10.78.190.232', '10.78.190.233',
                   '10.78.190.234', '10.78.190.235']
    SQLALCHEMY_DATABASE_URI = "oracle://spd_admin:spd_admin_1Q#@pdb_spider"
    SHOW_DATABASE_URI = "oracle://spd_dm:spd_dm_1Q#@pdb_spider"
    redis_nodes = [{'host': '10.78.155.61', 'port': 16340},
                   {'host': '10.78.155.67', 'port': 16340},
                   {'host': '10.78.155.68', 'port': 16340},
                   {'host': '10.78.155.70', 'port': 16340},
                   {'host': '10.78.155.71', 'port': 16340},
                   {'host': '10.78.155.72', 'port': 16340},
                   ]
    redis_expires = 86400
    # persist = ["hbase","hdfs","es"]
    landing = []
    hbase_host = '10.78.138.74'
    hbase_port = 9090
    accessid = '480092febea017febfe4'
    accesskey = '3fe3bccd97e3c8cb9c5b57cffc74090671722641'
    es_host = ['10.78.190.228', '10.78.190.229', '10.78.190.230', '10.78.190.231', '10.78.190.232', '10.78.190.233',
               '10.78.190.234', '10.78.190.235']
    hdfs_web = "http://10.78.138.81:50070"
    hdfs_dir = "/user/spider/cplatform/"
    hdfs_user = "hadoop"
